package br.com.loja.model.service.factory;

import br.com.loja.model.dao.factory.IDAOFactory;
import br.com.loja.model.service.Service;
import br.com.loja.model.service.exception.ServiceException;
import java.util.List;

/**
 *
 * @author CASA
 */
public abstract class ServiceFactory {

    protected abstract IDAOFactory getDAOFactory();

    public <T> Service<T> getService(Class<T> clazz) {
        return new Service(getDAOFactory(), clazz);
    }

    public static ServiceFactory getServiceFactory() throws ServiceException {
        return ServiceFactoryProducer.getInstance().createServiceFactory();
    }

    public static <T> ServiceFactory getServiceFactory(List<T> database) throws ServiceException {
        return ServiceFactoryProducer.getInstance().createServiceFactory(database);
    }

}
